package com.ylr.自定义枚举类校验;


import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

@Documented
@Target({ElementType.METHOD,ElementType.FIELD,ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = {EnumValidator.class})
public @interface EnumValueValidation {
    String message() default "验证失败";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};


    /**
     * 允许的枚举
     * @return
     */
    Class<? extends Enum<?>> enumClass();

    boolean isList() default false;

    /**
     * 校验调用的枚举类的方法
     * @return
     */
    String enumMethod();


    @Documented
    @Target({ElementType.METHOD,ElementType.FIELD,ElementType.ANNOTATION_TYPE})
    @Retention(RetentionPolicy.RUNTIME)
    @interface List{
        EnumValueValidation[] value();
    }

}
